using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Verifications;
using Pixysoft.Weblications.Sango.Constant;

namespace Pixysoft.Weblications.Sango.Battle
{
    class BattleAttackFactory
    {
        static List<IBattleAttack> attacks = new List<IBattleAttack>();

        static BattleAttackFactory()
        {
            attacks.Add(new BattleAttackSingle());
            attacks.Add(new BattleAttackColumn());
            attacks.Add(new BattleAttackRow());

            attacks.Add(new BattleMagicAttackSingle());
            attacks.Add(new BattleMagicAttackColumn());
            attacks.Add(new BattleMagicAttackRow());
        }

        public static IBattleAttack getAttack(long attackTypecode)
        {
            foreach (IBattleAttack attack in attacks)
            {
                if (attack.accept(attackTypecode))
                    return attack;
            }

            throw Exceptions.VerificationFailedException(attackTypecode);
        }
    }
}